package com.ch06.ex04;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;

import java.nio.charset.Charset;

/**
 * Created by zc on 2016/3/17.
 */
public class Test3Main {

    public static void main(String[] args){
        Charset utf8 = Charset.forName("UTF-8");

        ByteBuf buf = Unpooled.copiedBuffer("Netty in Action rocks!", utf8);
        System.out.println((char)buf.getByte(0));

        System.out.println(buf.readerIndex());
        System.out.println(buf.writerIndex());

        buf.setByte(0,(byte)'B');

        System.out.println((char)buf.getByte(0));

        System.out.println(buf.readerIndex());
        System.out.println(buf.writerIndex());

    }
}
